import java.util.HashMap;
import java.util.Map;


public class Leetcode141 {

    public static void main(String[] args) {

    }

    public boolean hasCycle(ListNode head) {
        ListNode node = head;
        while (node != null) {
            if (node.val == 9999999) return true;

            node.val = 9999999;
            node = node.next;
        }

        return false;
    }
}
